local addonName = "PSLibBar";
local moduleName = "Options";
local Addon = LibStub("AceAddon-3.0"):GetAddon(addonName);
local Module = Addon:NewModule(moduleName);
local L = LibStub("AceLocale-3.0"):GetLocale(addonName);

local optionTable = 
{
	name = L["OptionDialog.SettingsFrame.Title"],
	type = "group",
	childGroups = "tab",
	args = { }
}

function Module:OnInitialize()	
	LibStub("AceConfig-3.0"):RegisterOptionsTable(addonName, optionTable);
end

function Module:OnEnable()
end

function Module:OnSettingsUpdated()
	optionTable.args = {};
	
	for key,module in Addon:IterateModules() do
		if(module.optionTable) then optionTable.args[key] = module.optionTable; end
	end
	
	local profilesOptionTable = LibStub("AceDBOptions-3.0"):GetOptionsTable(Addon.db);
	profilesOptionTable.order = 2.0;
	optionTable.args["Profiles"] = profilesOptionTable;
	LibStub("AceConfigRegistry-3.0"):NotifyChange(addonName);
end
